/**
 * 文章请求相关模块
 */
 import request from '../utils/request.js'
 /**
  * 读取文章列表
  */
export const getArticles = (params)=> {
    return request({
        method: 'GET',
        url: '/mp/v1_0/articles',
        params
    })

}
//获取文章频道
export const getArticlesChannel = ()=> {
    return request({
        method: 'GET',
        url: '/mp/v1_0/channels',
    })

}
//删除文章
export const removeArticle = (id)=> {
    return request({
        method: 'DELETE',
        url: `/mp/v1_0/articles/${id}`,
    })

} 

//发布文章
export const publishArticle = (data,draft = false)=> {
    return request({
        method:'POST',
        url: '/mp/v1_0/articles',
        params:{
            draft
        },
        data:data,
    })
}
//根据文章id获取文章内容
export const GetArticleById = (id)=> {
    return request({
        method: 'GET',
        url: `/mp/v1_0/articles/${id}`
    })
}
//编辑文章
export const editArticle = (id,data,draft = false)=> {
    return request({
        method: 'PUT',
        url: `/mp/v1_0/articles/${id}`,
        data,
        draft: {
            draft
        }
    })
}











//  export const getArticles = (params) => {
//      return request ({
//          method: 'GET',
//          url:'/app/v1_1/articles',
//          params 
//      })
//  }
//  /**
//   * 获取文章内容
//   */
//  export const ArticleContent = articleId => {
//      return request ({
//          method: 'GET',
//          url:`/app/v1_0/articles/${articleId}`,
//      })
//  }